package com.bdqn.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
public class HelloController {

    @GetMapping(value = "/hello")
    public String hello1(){
        System.out.println("hello");
        return "hello";
    }
    @PostMapping("/showAction")
    public String submitAccount(@RequestParam("account") String account, Model model) {
        // 将账号信息添加到Model中，以便在show.jsp页面中访问
        model.addAttribute("account", account);
        // 返回show.jsp页面的逻辑视图名
        return "show";
    }

}
